import java.util.HashMap;

public class _findRepeatNumber {
    public int findRepeatNumber1(int[] nums) {
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int n : nums) {
            map.put(n, map.getOrDefault(n, 0) + 1);
            if (map.get(n) >= 2) {
                return n;
            }

        }
        return -1;
    }
}
